package com.ruoyi.teach.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teach.mapper.TeachBookUserMapper;
import com.ruoyi.teach.domain.TeachBookUser;
import com.ruoyi.teach.service.ITeachBookUserService;

/**
 * 参与人Service业务层处理
 * 
 * @author yepanpan
 * @date 2021-03-15
 */
@Service
public class TeachBookUserServiceImpl implements ITeachBookUserService 
{
    @Autowired
    private TeachBookUserMapper teachBookUserMapper;

    /**
     * 查询参与人
     * 
     * @param id 参与人ID
     * @return 参与人
     */
    @Override
    public TeachBookUser selectTeachBookUserById(Long id)
    {
        return teachBookUserMapper.selectTeachBookUserById(id);
    }

    /**
     * 查询参与人列表
     * 
     * @param teachBookUser 参与人
     * @return 参与人
     */
    @Override
    public List<TeachBookUser> selectTeachBookUserList(TeachBookUser teachBookUser)
    {
        return teachBookUserMapper.selectTeachBookUserList(teachBookUser);
    }

    /**
     * 新增参与人
     * 
     * @param teachBookUser 参与人
     * @return 结果
     */
    @Override
    public int insertTeachBookUser(TeachBookUser teachBookUser)
    {
        teachBookUser.setCreateTime(DateUtils.getNowDate());
        teachBookUser.setCreateBy(SecurityUtils.getUsername());
        return teachBookUserMapper.insertTeachBookUser(teachBookUser);
    }

    /**
     * 修改参与人
     * 
     * @param teachBookUser 参与人
     * @return 结果
     */
    @Override
    public int updateTeachBookUser(TeachBookUser teachBookUser)
    {
        teachBookUser.setUpdateTime(DateUtils.getNowDate());
        teachBookUser.setUpdateBy(SecurityUtils.getUsername());
        return teachBookUserMapper.updateTeachBookUser(teachBookUser);
    }

    /**
     * 批量删除参与人
     * 
     * @param ids 需要删除的参与人ID
     * @return 结果
     */
    @Override
    public int deleteTeachBookUserByIds(Long[] ids)
    {
        return teachBookUserMapper.deleteTeachBookUserByIds(ids);
    }

    /**
     * 删除参与人信息
     * 
     * @param id 参与人ID
     * @return 结果
     */
    @Override
    public int deleteTeachBookUserById(Long id)
    {
        return teachBookUserMapper.deleteTeachBookUserById(id);
    }
}
